package itbour.onetouchshow.adapter;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.text.TextUtils;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import itbour.onetouchshow.R;
import itbour.onetouchshow.adapter.base.BaseAdapterHelper;
import itbour.onetouchshow.adapter.base.normal.QuickAdapter;
import itbour.onetouchshow.bean.VipInfoBean;

/**
 * Created by guoh on 2018/3/30.
 * 功能描述：
 * 需要的参数：
 */

public class VipPriceAdapter extends QuickAdapter<VipInfoBean.IntroduceInfoBean.VipGoodsBean> {
    public VipPriceAdapter(Context context) {
        super(context, R.layout.item_vip_price);
    }

    @Override
    protected void convert(BaseAdapterHelper helper, VipInfoBean.IntroduceInfoBean.VipGoodsBean item, int position) {
        if (!TextUtils.isEmpty(item.getAdImg().getUrl())) {
            Glide.with(context).load(item.getAdImg().getUrl()).into((ImageView) helper.getView(R.id.iv_adImg));
        }
        helper.setVisible(R.id.iv_introduce, item.getRecommend() == 1);
        if (item.isSelected()) {
            helper.getView(R.id.rl_layout).setBackground(context.getResources().getDrawable(R.drawable.price_select_style));
        } else {
            helper.getView(R.id.rl_layout).setBackground(new BitmapDrawable());
        }
    }
}
